package com.one.group.admin.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.one.group.admin.mapper.VisitorMapper;
import com.one.group.enums.ErrorCode;
import com.one.group.model.dto.VisitorQueryDto;
import com.one.group.model.entity.Visitor;
import com.one.group.model.vo.VisitorListVo;
import com.one.group.service.VisitorService;
import com.one.group.utils.ThrowUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author wanbo
 * @Date 2025/9/28 19:44
 */
@Service
@Slf4j
@DubboService
public class VisitorServiceImpl extends ServiceImpl<VisitorMapper, Visitor> implements VisitorService {

    @Autowired
    private VisitorMapper visitorMapper;

    @Override
    public List<VisitorListVo> findVisitorByQueryDto(VisitorQueryDto visitorQueryDto) {
        ThrowUtil.throwIf(ObjectUtil.isEmpty(visitorQueryDto), ErrorCode.PARAMS_ERROR);
        List<VisitorListVo> visitorList = visitorMapper.findVisitorByQueryDto(visitorQueryDto);
        return visitorList;
    }
}
